
$(function () {

    var eid = GetQueryString("eid");
    var qrCode = GetQueryString("qrCode");

    $("#qrCode").val(qrCode);

    var sel = $.Params.create();
    sel.ajax("get", getAdminIP() + "qdArticles/" + eid, function (data) {
        if (data.success) {
            var val = data.result;
            $("#pUrl").attr('src', getIP() + "data/qdArticle/" + val.pic);
            $("#title").val(val.title);
            $("#authUrl").val(val.jwytAuth.url);
            $("#decription").val(val.decription);
            $("#code").val(val.code);
            $("#type").val(val.type);
        } else {
            alert(data.msg);
        }
    })
    $("#pic").on("change", function (e) {
        var src, url = window.URL || window.webkitURL || window.mozURL, files = e.target.files;
        // for (var i = 0, len = files.length; i < len; ++i) {
        var file = files[0];
        if (url) {
            src = url.createObjectURL(file);
        } else {
            src = e.target.result[0];
        }

        $("#pUrl").attr('src', src);
        // }
    });
    //取消时
    $("#cancelAdd").on("click", function () {
        window.history.go(-1);
    })

    $("#addData").on("click", function () {
        $("#addForm").attr("action", getAdminIP() + "qdArticles/" + eid);
        $("#addForm").submit();
    })
});

